package zhao.exmaple;

// java引入
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
// scala引入
// import org.apache.flink.api.scala.ExecutionEnvironment
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

public class Demo1 {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        // 从集合读取
        DataStreamSource<Integer> source = env.fromCollection(Arrays.asList(12, 3, 4, 5, 6));
        source.print();

        // 从文件读取
        DataStreamSource<String> stringsource = env.readTextFile("E:\\note\\flink-project\\temp\\word.txt", StandardCharsets.UTF_8.toString());
        stringsource.print();

        env.execute();
    }
}
